package com.zhanghe.mall.web.controller;

import com.zhanghe.mall.pojo.Manager;
import com.zhanghe.mall.service.ManagerService;
import com.zhanghe.mall.service.StaffService;
import com.zhanghe.mall.service.vo.ManagerInfoVO;
import com.zhanghe.mall.service.vo.ManagerPermissionsVO;
import com.zhanghe.mall.web.util.R;
import com.zhanghe.mall.web.vo.StaffVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ManagerController {
//
//    @Autowired
//    private ManagerService managerService;
//    @Autowired
//    private StaffService staffService;
//    @RequestMapping("/current_user")
//    public String getCurrentUser(){
//        String userName =  SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
////        ManagerInfoVO manager = managerService.findManagerInfoVOByUserName(userName);
//        StaffVO staff = StaffVO.transform(staffService.findStaffByAccountUserName(userName));
//        R r = new R(staff);
//        return r.toString();
//    }
//
//    @RequestMapping("/get_menu")
//    public String getMenu(){
//        String userName =  SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString();
//        Manager manager = managerService.findByUserName(userName);
//        List<ManagerPermissionsVO> result = managerService.getManagerAllPermissions(manager.getId());
//        R r = new R(result);
//        return r.toString();
//    }

}
